﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp4
{
    public partial class RegisterForm : Form
    {
        public RegisterForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            var uid = txtUserName.Text;
            var pwd = txtPassWord.Text;
            var rePwd = txtRePassWord.Text;

            var boolUid = !string.IsNullOrEmpty(uid);
            var boolPwd = !string.IsNullOrEmpty(pwd);
            var boolRePwd = pwd == rePwd;

            if (boolUid && boolPwd & boolRePwd)
            {
                MessageBox.Show("注册成功!", "提示");
            }
            else if (boolPwd && boolRePwd)
            {
                MessageBox.Show("用户名不能为空!", "提示");
            }
            else if (boolUid)
            {
                MessageBox.Show("请输入密码及确认密码!", "提示");
            }
            else if (boolUid && !boolRePwd)
            {
                MessageBox.Show("前后密码不一致!", "提示");
            }
            else
            {
                MessageBox.Show("不能空白注册!", "提示");
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
